{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "<h1 align=\"center\">Non-Rigid Registration: Demons</h1>\n",
    "\n",
    "This notebook illustrates the use of the Demons based non-rigid registration set of algorithms in SimpleITK. These include both the DemonsMetric which is part of the registration framework and Demons registration filters which are not.\n",
    "\n",
    "The data we work with is a 4D (3D+time) thoracic-abdominal CT, the Point-validated Pixel-based Breathing Thorax Model (POPI) model. This data consists of a set of temporal CT volumes, a set of masks segmenting each of the CTs to air/body/lung, and a set of corresponding points across the CT volumes. \n",
    "\n",
    "The POPI model is provided by the Léon Bérard Cancer Center & CREATIS Laboratory, Lyon, France. The relevant publication is:\n",
    "\n",
    "J. Vandemeulebroucke, D. Sarrut, P. Clarysse, \"The POPI-model, a point-validated pixel-based breathing thorax model\",\n",
    "Proc. XVth International Conference on the Use of Computers in Radiation Therapy (ICCR), Toronto, Canada, 2007.\n",
    "\n",
    "The POPI data, and additional 4D CT data sets with reference points are available from the CREATIS Laboratory <a href=\"http://www.creatis.insa-lyon.fr/rio/popi-model?action=show&redirect=popi\">here</a>. "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from __future__ import print_function\n",
    "\n",
    "import SimpleITK as sitk\n",
    "import numpy as np\n",
    "\n",
    "# If the environment variable SIMPLE_ITK_MEMORY_CONSTRAINED_ENVIRONMENT is set, this will override the ReadImage\n",
    "# function so that it also resamples the image to a smaller size (testing environment is memory constrained).\n",
    "%run setup_for_testing\n",
    "\n",
    "import registration_utilities as ru\n",
    "import registration_callbacks as rc\n",
    "\n",
    "%matplotlib inline\n",
    "import matplotlib.pyplot as plt\n",
    "\n",
    "from ipywidgets import interact, fixed\n",
    "\n",
    "#utility method that either downloads data from the Girder repository or\n",
    "#if already downloaded returns the file name for reading from disk (cached data)\n",
    "%run update_path_to_download_script\n",
    "from downloaddata import fetch_data as fdata"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Utilities\n",
    "\n",
    "Load utilities that are specific to the POPI data, functions for loading ground truth data, display and the labels for masks."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "%run popi_utilities_setup.py"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Loading Data\n",
    "\n",
    "Load all of the images, masks and point data into corresponding lists. If the data is not available locally it will be downloaded from the original remote repository. \n",
    "\n",
    "Take a look at the images. According to the documentation on the POPI site, volume number one corresponds to end inspiration (maximal air volume)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "images = []\n",
    "masks = []\n",
    "points = []\n",
    "for i in range(0,10):\n",
    "    image_file_name = 'POPI/meta/{0}0-P.mhd'.format(i)\n",
    "    mask_file_name = 'POPI/masks/{0}0-air-body-lungs.mhd'.format(i)\n",
    "    points_file_name = 'POPI/landmarks/{0}0-Landmarks.pts'.format(i)\n",
    "    images.append(sitk.ReadImage(fdata(image_file_name), sitk.sitkFloat32)) #read and cast to format required for registration\n",
    "    masks.append(sitk.ReadImage(fdata(mask_file_name)))\n",
    "    points.append(read_POPI_points(fdata(points_file_name)))\n",
    "        \n",
    "interact(display_coronal_with_overlay, temporal_slice=(0,len(images)-1), \n",
    "         coronal_slice = (0, images[0].GetSize()[1]-1), \n",
    "         images = fixed(images), masks = fixed(masks), \n",
    "         label=fixed(lung_label), window_min = fixed(-1024), window_max=fixed(976));"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Demons Registration\n",
    "\n",
    "This function will align the fixed and moving images using the Demons registration method. If given a mask, the similarity metric will be evaluated using points sampled inside the mask. If given fixed and moving points the similarity metric value and the target registration errors will be displayed during registration. \n",
    "\n",
    "As this notebook performs intra-modal registration, we can readily use the Demons family of algorithms.\n",
    "\n",
    "We start by using the registration framework with SetMetricAsDemons. We use a multiscale approach which is readily available in the framework. We then illustrate how to use the Demons registration filters that are not part of the registration framework."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def demons_registration(fixed_image, moving_image, fixed_points = None, moving_points = None):\n",
    "    \n",
    "    registration_method = sitk.ImageRegistrationMethod()\n",
    "\n",
    "    # Create initial identity transformation.\n",
    "    transform_to_displacment_field_filter = sitk.TransformToDisplacementFieldFilter()\n",
    "    transform_to_displacment_field_filter.SetReferenceImage(fixed_image)\n",
    "    # The image returned from the initial_transform_filter is transferred to the transform and cleared out.\n",
    "    initial_transform = sitk.DisplacementFieldTransform(transform_to_displacment_field_filter.Execute(sitk.Transform()))\n",
    "    \n",
    "    # Regularization (update field - viscous, total field - elastic).\n",
    "    initial_transform.SetSmoothingGaussianOnUpdate(varianceForUpdateField=0.0, varianceForTotalField=2.0) \n",
    "    \n",
    "    registration_method.SetInitialTransform(initial_transform)\n",
    "\n",
    "    registration_method.SetMetricAsDemons(10) #intensities are equal if the difference is less than 10HU\n",
    "        \n",
    "    # Multi-resolution framework.            \n",
    "    registration_method.SetShrinkFactorsPerLevel(shrinkFactors = [4,2,1])\n",
    "    registration_method.SetSmoothingSigmasPerLevel(smoothingSigmas=[8,4,0])    \n",
    "\n",
    "    registration_method.SetInterpolator(sitk.sitkLinear)\n",
    "    # If you have time, run this code as is, otherwise switch to the gradient descent optimizer    \n",
    "    #registration_method.SetOptimizerAsConjugateGradientLineSearch(learningRate=1.0, numberOfIterations=20, convergenceMinimumValue=1e-6, convergenceWindowSize=10)\n",
    "    registration_method.SetOptimizerAsGradientDescent(learningRate=1.0, numberOfIterations=20, convergenceMinimumValue=1e-6, convergenceWindowSize=10)\n",
    "    registration_method.SetOptimizerScalesFromPhysicalShift()\n",
    "\n",
    "    # If corresponding points in the fixed and moving image are given then we display the similarity metric\n",
    "    # and the TRE during the registration.\n",
    "    if fixed_points and moving_points:\n",
    "        registration_method.AddCommand(sitk.sitkStartEvent, rc.metric_and_reference_start_plot)\n",
    "        registration_method.AddCommand(sitk.sitkEndEvent, rc.metric_and_reference_end_plot)        \n",
    "        registration_method.AddCommand(sitk.sitkIterationEvent, lambda: rc.metric_and_reference_plot_values(registration_method, fixed_points, moving_points))\n",
    "        \n",
    "    return registration_method.Execute(fixed_image, moving_image)    "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Running the Demons registration with the conjugate gradient optimizer on this data <font color=\"red\">takes a long time</font> which is why the code above uses gradient descent. If you are more interested in accuracy and have the time then switch to the conjugate gradient optimizer."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#%%timeit -r1 -n1\n",
    "# Uncomment the line above if you want to time the running of this cell.\n",
    "\n",
    "# Select the fixed and moving images, valid entries are in [0,9]\n",
    "fixed_image_index = 0\n",
    "moving_image_index = 7\n",
    "\n",
    "\n",
    "tx = demons_registration(fixed_image = images[fixed_image_index], \n",
    "                         moving_image = images[moving_image_index],\n",
    "                         fixed_points = points[fixed_image_index], \n",
    "                         moving_points = points[moving_image_index]\n",
    "                         )\n",
    "initial_errors_mean, initial_errors_std, _, initial_errors_max, initial_errors = ru.registration_errors(sitk.Euler3DTransform(), points[fixed_image_index], points[moving_image_index])\n",
    "final_errors_mean, final_errors_std, _, final_errors_max, final_errors = ru.registration_errors(tx, points[fixed_image_index], points[moving_image_index])\n",
    "\n",
    "plt.hist(initial_errors, bins=20, alpha=0.5, label='before registration', color='blue')\n",
    "plt.hist(final_errors, bins=20, alpha=0.5, label='after registration', color='green')\n",
    "plt.legend()\n",
    "plt.title('TRE histogram');\n",
    "print('Initial alignment errors in millimeters, mean(std): {:.2f}({:.2f}), max: {:.2f}'.format(initial_errors_mean, initial_errors_std, initial_errors_max))\n",
    "print('Final alignment errors in millimeters, mean(std): {:.2f}({:.2f}), max: {:.2f}'.format(final_errors_mean, final_errors_std, final_errors_max))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SimpleITK also includes a set of Demons filters which are independent of the ImageRegistrationMethod. These include: \n",
    "1. DemonsRegistrationFilter\n",
    "2. DiffeomorphicDemonsRegistrationFilter\n",
    "3. FastSymmetricForcesDemonsRegistrationFilter\n",
    "4. SymmetricForcesDemonsRegistrationFilter\n",
    "\n",
    "As these filters are independent of the ImageRegistrationMethod we do not have access to the multiscale framework. Luckily it is easy to implement our own multiscale framework in SimpleITK, which is what we do in the next cell."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "def smooth_and_resample(image, shrink_factors, smoothing_sigmas):\n",
    "    \"\"\"\n",
    "    Args:\n",
    "        image: The image we want to resample.\n",
    "        shrink_factor(s): Number(s) greater than one, such that the new image's size is original_size/shrink_factor.\n",
    "        smoothing_sigma(s): Sigma(s) for Gaussian smoothing, this is in physical units, not pixels.\n",
    "    Return:\n",
    "        Image which is a result of smoothing the input and then resampling it using the given sigma(s) and shrink factor(s).\n",
    "    \"\"\"\n",
    "    if np.isscalar(shrink_factors):\n",
    "        shrink_factors = [shrink_factors]*image.GetDimension()\n",
    "    if np.isscalar(smoothing_sigmas):\n",
    "        smoothing_sigmas = [smoothing_sigmas]*image.GetDimension()\n",
    "\n",
    "    smoothed_image = sitk.SmoothingRecursiveGaussian(image, smoothing_sigmas)\n",
    "    \n",
    "    original_spacing = image.GetSpacing()\n",
    "    original_size = image.GetSize()\n",
    "    new_size = [int(sz/float(sf) + 0.5) for sf,sz in zip(shrink_factors,original_size)]\n",
    "    new_spacing = [((original_sz-1)*original_spc)/(new_sz-1) \n",
    "                   for original_sz, original_spc, new_sz in zip(original_size, original_spacing, new_size)]\n",
    "    return sitk.Resample(smoothed_image, new_size, sitk.Transform(), \n",
    "                         sitk.sitkLinear, image.GetOrigin(),\n",
    "                         new_spacing, image.GetDirection(), 0.0, \n",
    "                         image.GetPixelID())\n",
    "\n",
    "\n",
    "    \n",
    "def multiscale_demons(registration_algorithm,\n",
    "                      fixed_image, moving_image, initial_transform = None, \n",
    "                      shrink_factors=None, smoothing_sigmas=None):\n",
    "    \"\"\"\n",
    "    Run the given registration algorithm in a multiscale fashion. The original scale should not be given as input as the\n",
    "    original images are implicitly incorporated as the base of the pyramid.\n",
    "    Args:\n",
    "        registration_algorithm: Any registration algorithm that has an Execute(fixed_image, moving_image, displacement_field_image)\n",
    "                                method.\n",
    "        fixed_image: Resulting transformation maps points from this image's spatial domain to the moving image spatial domain.\n",
    "        moving_image: Resulting transformation maps points from the fixed_image's spatial domain to this image's spatial domain.\n",
    "        initial_transform: Any SimpleITK transform, used to initialize the displacement field.\n",
    "        shrink_factors (list of lists or scalars): Shrink factors relative to the original image's size. When the list entry, \n",
    "                                                   shrink_factors[i], is a scalar the same factor is applied to all axes.\n",
    "                                                   When the list entry is a list, shrink_factors[i][j] is applied to axis j.\n",
    "                                                   This allows us to specify different shrink factors per axis. This is useful\n",
    "                                                   in the context of microscopy images where it is not uncommon to have\n",
    "                                                   unbalanced sampling such as a 512x512x8 image. In this case we would only want to \n",
    "                                                   sample in the x,y axes and leave the z axis as is: [[[8,8,1],[4,4,1],[2,2,1]].\n",
    "        smoothing_sigmas (list of lists or scalars): Amount of smoothing which is done prior to resmapling the image using the given shrink factor. These\n",
    "                          are in physical (image spacing) units.\n",
    "    Returns: \n",
    "        SimpleITK.DisplacementFieldTransform\n",
    "    \"\"\"\n",
    "    # Create image pyramid in a memory efficient manner using a generator function.\n",
    "    # The whole pyramid never exists in memory, each level is created when iterating over\n",
    "    # the generator.\n",
    "    def image_pair_generator(fixed_image, moving_image, shrink_factors, smoothing_sigmas):\n",
    "        end_level = 0\n",
    "        start_level = 0\n",
    "        if shrink_factors is not None:\n",
    "            end_level = len(shrink_factors)\n",
    "        for level in range(start_level, end_level):\n",
    "            f_image = smooth_and_resample(fixed_image, shrink_factors[level], smoothing_sigmas[level])\n",
    "            m_image = smooth_and_resample(moving_image, shrink_factors[level], smoothing_sigmas[level])\n",
    "            yield(f_image, m_image)\n",
    "        yield(fixed_image, moving_image)\n",
    "    \n",
    "    # Create initial displacement field at lowest resolution. \n",
    "    # Currently, the pixel type is required to be sitkVectorFloat64 because \n",
    "    # of a constraint imposed by the Demons filters.\n",
    "    if shrink_factors is not None:\n",
    "        original_size = fixed_image.GetSize()\n",
    "        original_spacing = fixed_image.GetSpacing()\n",
    "        s_factors =  [shrink_factors[0]]*len(original_size) if np.isscalar(shrink_factors[0]) else shrink_factors[0]\n",
    "        df_size = [int(sz/float(sf) + 0.5) for sf,sz in zip(s_factors,original_size)]\n",
    "        df_spacing = [((original_sz-1)*original_spc)/(new_sz-1) \n",
    "                      for original_sz, original_spc, new_sz in zip(original_size, original_spacing, df_size)]\n",
    "    else:\n",
    "        df_size = fixed_image.GetSize()\n",
    "        df_spacing = fixed_image.GetSpacing()\n",
    " \n",
    "    if initial_transform:\n",
    "        initial_displacement_field = sitk.TransformToDisplacementField(initial_transform, \n",
    "                                                                       sitk.sitkVectorFloat64,\n",
    "                                                                       df_size,\n",
    "                                                                       fixed_image.GetOrigin(),\n",
    "                                                                       df_spacing,\n",
    "                                                                       fixed_image.GetDirection())\n",
    "    else:\n",
    "        initial_displacement_field = sitk.Image(df_size, sitk.sitkVectorFloat64, fixed_image.GetDimension())\n",
    "        initial_displacement_field.SetSpacing(df_spacing)\n",
    "        initial_displacement_field.SetOrigin(fixed_image.GetOrigin())\n",
    " \n",
    "    # Run the registration.            \n",
    "    # Start at the top of the pyramid and work our way down.    \n",
    "    for f_image, m_image in image_pair_generator(fixed_image, moving_image, shrink_factors, smoothing_sigmas):\n",
    "        initial_displacement_field = sitk.Resample (initial_displacement_field, f_image)\n",
    "        initial_displacement_field = registration_algorithm.Execute(f_image, m_image, initial_displacement_field)\n",
    "    return sitk.DisplacementFieldTransform(initial_displacement_field)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we will use our newly minted multiscale framework to perform registration with the Demons filters. Some things you can easily try out by editing the code below:\n",
    "1. Is there really a need for multiscale - just call the multiscale_demons method without the shrink_factors and smoothing_sigmas parameters.\n",
    "2. Which Demons filter should you use - configure the other filters and see if our selection is the best choice (accuracy/time)."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Define a simple callback which allows us to monitor the Demons filter's progress.\n",
    "def iteration_callback(filter):\n",
    "    print('\\r{0}: {1:.2f}'.format(filter.GetElapsedIterations(), filter.GetMetric()), end='')\n",
    "\n",
    "fixed_image_index = 0\n",
    "moving_image_index = 7\n",
    "\n",
    "# Select a Demons filter and configure it.\n",
    "demons_filter =  sitk.FastSymmetricForcesDemonsRegistrationFilter()\n",
    "demons_filter.SetNumberOfIterations(20)\n",
    "# Regularization (update field - viscous, total field - elastic).\n",
    "demons_filter.SetSmoothDisplacementField(True)\n",
    "demons_filter.SetStandardDeviations(2.0)\n",
    "\n",
    "# Add our simple callback to the registration filter.\n",
    "demons_filter.AddCommand(sitk.sitkIterationEvent, lambda: iteration_callback(demons_filter))\n",
    "\n",
    "# Run the registration.\n",
    "tx = multiscale_demons(registration_algorithm=demons_filter, \n",
    "                       fixed_image = images[fixed_image_index], \n",
    "                       moving_image = images[moving_image_index],\n",
    "                       shrink_factors = [4,2],\n",
    "                       smoothing_sigmas = [8,4])\n",
    "\n",
    "# Compare the initial and final TREs.\n",
    "initial_errors_mean, initial_errors_std, _, initial_errors_max, initial_errors = ru.registration_errors(sitk.Euler3DTransform(), points[fixed_image_index], points[moving_image_index])\n",
    "final_errors_mean, final_errors_std, _, final_errors_max, final_errors = ru.registration_errors(tx, points[fixed_image_index], points[moving_image_index])\n",
    "\n",
    "plt.hist(initial_errors, bins=20, alpha=0.5, label='before registration', color='blue')\n",
    "plt.hist(final_errors, bins=20, alpha=0.5, label='after registration', color='green')\n",
    "plt.legend()\n",
    "plt.title('TRE histogram');\n",
    "print('\\nInitial alignment errors in millimeters, mean(std): {:.2f}({:.2f}), max: {:.2f}'.format(initial_errors_mean, initial_errors_std, initial_errors_max))\n",
    "print('Final alignment errors in millimeters, mean(std): {:.2f}({:.2f}), max: {:.2f}'.format(final_errors_mean, final_errors_std, final_errors_max))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Transferring Segmentation\n",
    "\n",
    "The following example illustrates the use of the Demons registration method to transfer a segmentation from one dataset to another. Note that we use the same multi scale demons framework we used above for registering 3D images to register 2D images.\n",
    "\n",
    "Data provided courtesy of T. Sorensen, Signal Analysis and Interpretation Laboratory University of Southern California. Data acquisition protocol described in:\n",
    "\n",
    "S.G. Lingala, A. Toutios, J. Toger, Y. Lim, Y. Zhu, Y-C. Kim, C. Vaz, S. Narayanan, K.S. Nayak \"State of the art MRI protocol for comprehensive assessment of vocal tract structure and function\" Proceedings of Interspeech, San Francisco, 2016.\n",
    "\n",
    "\n",
    "**NOTE**: Segmented contour points are given in pixel coordinates. This is useful for plotting. To transfer the points to the second image we need to (1) use their physical coordinates, (2) transform them, and then (3) obtain the pixel coordinates for plotting. \n",
    "\n",
    "### Load Data"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "import glob\n",
    "import pandas as pd\n",
    "from gui import multi_image_display2D\n",
    "\n",
    "# Fetch all of the data associated with this example.\n",
    "data_directory = os.path.dirname(fdata(\"mr_slice_atlas/readme.txt\"))\n",
    "                                       \n",
    "segmented_img = sitk.ReadImage(os.path.join(data_directory,'segmented_image.mha'))\n",
    "new_img = sitk.ReadImage(os.path.join(data_directory,'new_image.mha'))\n",
    "\n",
    "contours_list = []\n",
    "for file_name in glob.glob(os.path.join(data_directory,'*.csv')):\n",
    "    df = pd.read_csv(file_name)\n",
    "    contours_list.append((list(df['X']), list(df['Y'])))\n",
    "\n",
    "# Display the images and overlay the contours onto the segmented image.\n",
    "fig,axes = multi_image_display2D([segmented_img, new_img])\n",
    "for contour in contours_list:\n",
    "    axes[0].plot(contour[0], contour[1], linewidth=5)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Register and transfer the segmentation."
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Select a Demons filter and configure it.\n",
    "demons_filter =  sitk.DiffeomorphicDemonsRegistrationFilter()\n",
    "demons_filter.SetNumberOfIterations(20)\n",
    "# Regularization (update field - viscous, total field - elastic).\n",
    "demons_filter.SetSmoothDisplacementField(True)\n",
    "demons_filter.SetStandardDeviations(0.8)\n",
    "\n",
    "# create initial transform\n",
    "initial_tfm = initial_transform = sitk.CenteredTransformInitializer(segmented_img, \n",
    "                                                                    new_img, \n",
    "                                                                    sitk.Euler2DTransform(), \n",
    "                                                                    sitk.CenteredTransformInitializerFilter.GEOMETRY)\n",
    "# Run the registration.\n",
    "final_tfm = multiscale_demons(registration_algorithm=demons_filter, \n",
    "                              fixed_image = segmented_img,\n",
    "                              moving_image = new_img,\n",
    "                              initial_transform = initial_tfm,\n",
    "                              shrink_factors = [6,4,2],\n",
    "                              smoothing_sigmas = [6,4,2])\n",
    "\n",
    "# Display the transformed segmentation.\n",
    "fig,axes = multi_image_display2D([segmented_img, new_img])\n",
    "for contour in contours_list:\n",
    "    # Plot on segmented image.\n",
    "    axes[0].plot(contour[0], contour[1], linewidth=5)\n",
    "    # Transform the contour points from segmented image to new image (requires the use of points in physical space)\n",
    "    transformed_contour = [new_img.TransformPhysicalPointToContinuousIndex(final_tfm.TransformPoint(segmented_img.TransformContinuousIndexToPhysicalPoint(p))) for p in zip(contour[0],contour[1])]\n",
    "    x_coords, y_coords = zip(*transformed_contour)\n",
    "    axes[1].plot(x_coords, y_coords, linewidth=5)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "anaconda-cloud": {},
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.3"
  },
  "widgets": {
   "state": {
    "feffa7c0572f431fb5e77268dd7a390f": {
     "views": [
      {
       "cell_index": 5
      }
     ]
    }
   },
   "version": "1.2.0"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
